#!/usr/bin/env python3
# -*- coding:utf-8 -*-
# @Project  :wangting_FastAPI
# @File     :main.py.py
# @Author   :wangting_666

from typing import Union
from fastapi import FastAPI
import mail_identification

app = FastAPI()


@app.get("/")
async def read_root():
    return {"Hello": "World"}


@app.get("/items/{item_id}")
async def read_item(item_id: int, q: Union[str, None] = None):
    return {"item_id": item_id, "q": q}


@app.get("/email/check")
async def email_check(q: Union[str, None] = None):
    res = mail_identification.emailCheck(q)
    return "正常" if res == 1 else "异常";
